import com.it.rabbitQM.RabbitMQProducerMain;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * projectName: spring_boot_RabbitQM
 *
 * @author: 王宝贵
 * time: 2024/9/10 19:39 周二
 * description: 订阅者模式
 */
@SpringBootTest(classes = RabbitMQProducerMain.class)
public class RabbitMQ002 {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public static final String EXCHANGE_FANOUT = "com.exchanges.fanout";

    @Test
    public void testSendMessageFanout() {
        rabbitTemplate.convertAndSend(EXCHANGE_FANOUT, "", "Hello fanout ~");
    }
}